/*
 * This file is Copyright 2002-2006 Loyola University Chicago,
 * Department of Computer Science and the Emerging Technologies Laboratory.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License via
 *    http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.citep.formats.input.accounts;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

import com.citep.business.Account;
import com.citep.business.AccountCategory;
import com.citep.business.AccountTypes;
import com.citep.db.hibernate.AccountDAO;

public class ImportedAccount extends Account {

	private AccountDAO parent;
	private Set<Account>children;// = new ArrayList();
	
	private int id;
	private String name;
	private String description;
	private BigDecimal currentBalance;
	private Date startPeriod;
	private Date endPeriod;
	private Date lastModified;
	
	private AccountTypes type;
	private boolean enabled;
	private AccountCategory accountCategory;
	
	private String importId; //ID of the account in the format we are importing from
	private String importParentId; //ID of the parent account
	
	public String getImportId() {
		return importId;
	}
	
	public void setImportId(String importId) {
		this.importId = importId;
	}	
	
	public String getImportParentId() {
		return importParentId;
	}

	public void setImportParentId(String importParentId) {
		this.importParentId = importParentId;
	}

	/**
	 * @return Returns the accountCategory.
	 */
	public AccountCategory getAccountCategory() {
		return accountCategory;
	}
	/**
	 * @param accountCategory The accountCategory to set.
	 */
	public void setAccountCategory(AccountCategory accountCategory) {
		this.accountCategory = accountCategory;
	}
	/**
	 * @return Returns the id.
	 */
	public int getId() {
		return id;
	}
	/**
	 * @param id The id to set.
	 */
	public void setId(int id) {
		this.id = id;
	}
	
	/**
	 * @return Returns the description.
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * @param description The description to set.
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	/**
	 * @return Returns the enabled.
	 */
	public boolean isEnabled() {
		return enabled;
	}
	/**
	 * @param enabled The enabled to set.
	 */
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	

	public Date getEndPeriod() {
		return endPeriod;
	}
	public void setEndPeriod(Date endPeriod) {
		this.endPeriod = endPeriod;
	}
	public Date getStartPeriod() {
		return startPeriod;
	}
	public void setStartPeriod(Date startPeriod) {
		this.startPeriod = startPeriod;
	}

	public BigDecimal getCurrentBalance() {
		return currentBalance;
	}
	public void setCurrentBalance(BigDecimal currentBalance) {
		this.currentBalance = currentBalance;
	}
	
	
	public AccountTypes getType() {
		
		return type;
	}
	public void setType(AccountTypes type) {
		this.type = type;
	}
	public Set<Account> getChildren() {
		return (Set<Account>)children;
	}
	public Account getParent() {
		return parent;
	}
	public boolean hasChildren() {
		return (children != null && !children.isEmpty());
	}
	public boolean hasParent() {
		return parent != null;
	}
	public void setChildren(Set<Account> children) {
		this.children = children;
	}
	public void setParent(Account parent) {
		this.parent = (AccountDAO)parent;
	}

	public String toString() {
		return "Account: " +
				"importId=" + this.importId + ", " +
				"parent=" + this.importParentId + ", " +
				"name=" + this.name + ", " +
				"description=" + this.description + ", " +
				"type=" + this.type + ", " +
				"enabled=" + this.enabled;
	}

	public Date getLastModified() {
		return lastModified;
	}

	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}
}
